import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";

export default defineConfig({
  base: "/",
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"), // 关键配置
    },
  },
  server: {
    proxy: {
      "/api": {
        target: "http://localhost:3001",
        changeOrigin: true, // 支持虚拟主机
        rewrite: (path) => path, // 不需要去掉 /api，后端就是 /api/xxx
      },
    },
  },
});
